<?php
session_start();
require_once ("../../src/entitys/Admin.php");
require_once ("../../src/dao/AdminDAO.php");
require_once('RedirectForward.php');

$url = "admin/admintaichinh.php";

if(isset($_POST['userName']) && isset($_POST['passWord'])) {
	$username = $_POST['userName'];
	$admin = new Admin();
	$admin -> setUser($username);
	$admin -> setPass(md5($_POST['passWord']));
	if(checkLoginAdmin($admin)) {
		$url = "admin/admin.php";
		$_SESSION['adminlogintconline'] = $username;
	} else {
		$url = "admin/admintaichinh.php?mess=Tên tài khoản hoặc mật khẩu không hợp lệ, vui lòng thử lại!";
	}
}
redirect($url);
?>